// Problem 20: Factorial digit sum
// n! means n × (n − 1) × ... × 3 × 2 × 1
// For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
// Find the sum of the digits in the number 100!

package main

import (
	"fmt"
	"math/big"
)

func p020() int {
	ans := big.NewInt(1)
	for x := 2; x <= 100; x++ {
		ans.Mul(ans, big.NewInt(int64(x)))
	}
	sum := 0
	for _, c := range []byte(ans.String()) {
		sum += int(c - 48)
	}
	fmt.Println("Problem 020:", sum)
	return sum
}
